<?php
namespace app\admin\service;
use app\admin\service\interface\CacheService;
use app\admin\service\interface\ConfigService;
use app\admin\service\interface\NavService;
use think\facade\Cache;

class CacheServiceImpl implements CacheService{
    public function init(){
        $this->initConfig();
        $this->initNav();
    }
    public function initConfig(){
        invoke(function (ConfigService $configService) {
            $res = $configService->buildCacheData();
            Cache::set(CacheService::CACHE_CONFIG, $res);
        });
    }
    public function initNav(){
        invoke(function (NavService $navService) {
            $res= $navService->buildCacheData();
            Cache::set(CacheService::CACHE_NAV,$res);
        });
    }
    public function initPermission(){
        // var_dump(true);
    }
}